             package com.java.diagnostics.visualizer.recommender.balanced;
             
             import com.java.diagnostics.visualizer.data.AggregateData;
             import com.java.diagnostics.visualizer.data.TupleData;
             import com.java.diagnostics.visualizer.recommender.Recommendation;
             import com.java.diagnostics.visualizer.recommender.RecommendationBase;
             import com.java.diagnostics.visualizer.recommender.util.RecommendationLabels;
             import java.text.MessageFormat;
             
             public class CheckGMPDutyTime
               extends RecommendationBase
               implements Recommendation
             {
               public void recommend(AggregateData data)
               {
                 TupleData gmpCycleTime = data.getTupleData("VGCLabels.gmp.cycle.time");
                 TupleData heapSize = data.getTupleData("VGCLabels.flat.heap.size");
                 
                 if ((gmpCycleTime != null) && (heapSize != null)) {
                   double gmpDutyTime = gmpCycleTime.getRawTotalY();
                   
                   double elapsedTime = heapSize.getRawMaxX() - heapSize.getRawMinX();
                   
                   long percentage = Math.round(gmpDutyTime / elapsedTime * 100.0D);
                   
                   if (percentage > 100L) {
                     percentage = 100L;
                   }
                   
                   if (gmpDutyTime > elapsedTime * 0.5D) {
                     String message = MessageFormat.format(
                       RecommendationLabels.DUTY_CYCLE_WARNING, 
                       new Object[] { Long.valueOf(percentage) });
                     
                     addWarning(data, message);
                   }
                 }
               }
             }


